import Vue from 'vue'
import Router from 'vue-router'
import Home from '../views/menu/menu'

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/login',
      component: resolve => require(['../views/login/login'], resolve)
    },
    {
      path: '/home',
      name: 'Home',
      component: Home,
      children: [
        {
          path: '/option',
          meta: {
            role: ['admin']
          },
          component: resolve => require(['../views/option'], resolve)
        },
        {
          path: '/home',
          meta: {
            role: ['admin']
          },
          component: resolve => require(['../views/home/home'], resolve)
        },
        {
          path: '*',
          name: '404',
          meta: {
            title: '出错了-该页面不存在'
          },
          component: (resolve) => require(['../views/404'], resolve)
        }
      ]
    }
  ]
})
